import { sync } from 'cross-spawn';
import moveDir from '../utils/move';

export default () => {
  sync(
    `git`,
    ['clone', 'https://gitlab-front.ebonex.io/frontend/base/qps-tpl.git'],
    { cwd: process.cwd(), stdio: 'inherit' },
  );
  sync(`rm`, ['-rf', '.git'], { cwd: process.cwd(), stdio: 'inherit' });
  moveDir('./qps-tpl', './');
  // return new Promise((resolve , reject) =>{
  //   sync(`rm`, ['-rf','.git'], { cwd: process.cwd(), stdio: 'inherit' });

  //   download('direct:https://gitlab-front.ebonex.io/frontend/base/qps-tpl.git#main', 'test/tmp', { clone: true }, function (err) {

  //     if(err) {
  //       console.log(err )

  //       reject(false)
  //       return;
  //     }
  //     if (fs.existsSync('.git')) {
  //         sync(`rm`, ['-rf','.git'], { cwd: process.cwd(), stdio: 'inherit' });
  //     }
  //     console.log("download" )

  //      resolve(true)
  //   })
  // })
};
